#include <stdio.h>
#include <stdlib.h>

#define MAX_SIZE  100000
int cache[MAX_SIZE];

void solve() {
	int v = 0;
	int n = 0;
	while (1) {
		scanf("%d", &v);
		if (v == -1)
			break;
		cache[n++] = v;
	}
	for (int i = n - 1; i >= 0; --i)
		printf("%d ", cache[i]);
	printf("\n");
}

int main()
{
	solve();
	return 0;
}